package com.cht.service.impl;

import com.cht.dao.ArticleDao;
import com.cht.pojo.Article;
import com.cht.service.ArticleService;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;

    @Override
    public PageInfo<Article> findAll(Integer pageNum, Integer pageSize) {
        Integer pageStart = (pageNum - 1) * pageSize;


        PageHelper.startPage(pageNum,pageSize);
        List<Article> list = articleDao.findAll();
        PageInfo<Article> pageInfo = new PageInfo<>(list);

        return pageInfo;
    }
}
